set(CMAKE_AUTORCC ON)

macro(declare_test testname)
    # gone: qt4_automoc("${testname}.cpp")
    set(SOURCES "${testname}.cpp")
    if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${testname}.h")
        list(APPEND SOURCES "${testname}.h")
    endif ()
    if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${testname}.qrc")
        list(APPEND SOURCES "${testname}.qrc")
    endif ()

    add_executable(${testname} ${SOURCES})
    target_include_directories(${testname} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
                                                   ${CMAKE_CURRENT_BINARY_DIR}
                                                   ${apiextractor_SOURCE_DIR}
                                                   )
    target_link_libraries(${testname} PRIVATE apiextractor Qt5::Test)
    add_test(${testname} ${testname})
    if (INSTALL_TESTS)
        install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${testname}
                DESTINATION share/apiextractor${apiextractor_SUFFIX}/tests)
    endif()
endmacro(declare_test testname)

declare_test(testabstractmetaclass)
declare_test(testabstractmetatype)
declare_test(testaddfunction)
declare_test(testarrayargument)
declare_test(testcodeinjection)
declare_test(testcontainer)
declare_test(testconversionoperator)
declare_test(testconversionruletag)
declare_test(testctorinformation)
declare_test(testdroptypeentries)
declare_test(testdtorinformation)
declare_test(testenum)
declare_test(testextrainclude)
declare_test(testfunctiontag)
declare_test(testimplicitconversions)
declare_test(testinserttemplate)
declare_test(testmodifyfunction)
declare_test(testmultipleinheritance)
declare_test(testnamespace)
declare_test(testnestedtypes)
declare_test(testnumericaltypedef)
declare_test(testprimitivetypetag)
declare_test(testrefcounttag)
declare_test(testreferencetopointer)
declare_test(testremovefield)
declare_test(testremoveimplconv)
declare_test(testremoveoperatormethod)
declare_test(testresolvetype)
declare_test(testreverseoperators)
declare_test(testtemplates)
declare_test(testtoposort)
declare_test(testvaluetypedefaultctortag)
declare_test(testvoidarg)
declare_test(testtyperevision)
if (NOT DISABLE_DOCSTRINGS)
    declare_test(testmodifydocumentation)
endif()

